<head>
<script src="../../../resources/gc.js"></script>
<script>

var pageHasLoaded = false;
var frameHasLoaded = false;

function pageLoaded()
{
    if (window.testRunner)
        testRunner.waitUntilDone();

    pageHasLoaded = true;
    if (pageHasLoaded && frameHasLoaded)
        runTest();
}

function frameLoaded()
{
    frameHasLoaded = true;
    if (pageHasLoaded && frameHasLoaded)
        runTest();
}

function runTest()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    var frame = document.getElementById("frame");
    frame.setAttribute("onload", "frameLoadedAgain()");
    frame.setAttribute("src", "about:blank");
}

function frameLoadedAgain()
{
    gc();
    document.getElementById("result").firstChild.data = "TEST PASSED - Unless an assertion or crash happens soon.";
    if (window.testRunner)
        testRunner.notifyDone();
}

</script>
</head>
<body onload="pageLoaded()">
<iframe id="frame" src="resources/adoptNode-node-list-cache-subframe.html" onload="frameLoaded()"></iframe>
<div id="result">TEST DID NOT RUN YET</div>
</body>
